using System;
using UnityEngine;

public class MyMath
{
	public static float GetSpeed(Vector3 lastPos, Vector3 newPs, float time)
	{
		if (time == 0f)
		{
			return 0f;
		}
		return Vector3.Distance(lastPos, newPs) / time;
	}

	public static Vector3 GetDir(Vector3 lastPos, Vector3 newPs)
	{
		return (newPs - lastPos).normalized;
	}

	public static float GetDelta(float a, float b, float c)
	{
		return b * b - 4f * a * c;
	}

	public static float GetRad(float dis, float angle)
	{
		return 0f - 2f * dis * Mathf.Cos(angle * ((float)Math.PI / 180f));
	}

	public static float GetPom(float a, float b)
	{
		return 1f - Mathf.Pow(a, b);
	}

	public static float GetSqrtOfMath(float a, float b, float d)
	{
		float num = (0f - b + Mathf.Sqrt(d)) / (2f * a);
		float num2 = (0f - b - Mathf.Sqrt(d)) / (2f * a);
		return (!(num > num2)) ? num2 : num;
	}

	public Vector3 GetHitPoint()
	{
		return Vector3.zero;
	}

	public static string TimeSet(float time)
	{
		string result = "0:00";
		if (time > 0f)
		{
			result = (int)time / 60 + ":";
			result = (((int)time % 60 < 10) ? (result + "0" + (int)time % 60) : (result + (int)time % 60));
		}
		return result;
	}

	public static string longtimeset(int time)
	{
		string result = "00:00:00";
		if (time > 0)
		{
			if (time >= 3600)
			{
				if (time >= 36000)
				{
					result = time / 3600 + ":";
					time %= 3600;
				}
				else
				{
					result = "0" + time / 3600 + ":";
					time %= 3600;
				}
			}
			else
			{
				result = "00:";
			}
			result = ((time / 60 < 10) ? (result + "0" + time / 60 + ":") : (result + time / 60 + ":"));
			result = ((time % 60 < 10) ? (result + "0" + time % 60) : (result + time % 60));
		}
		return result;
	}
}
